-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix file descriptor leaks in bindings and add test #11103
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jwhonce The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
03194e1
to
9f266de
Compare
@mheon https://github.com/containers/podman/pull/11103/files#diff-02a7031ca65fa34d69f3de533b25111aa07a03242c86c4660dbd35ec69d1cd2fR137 is causing me heartburn. Without a containers.Detach() it is not clear to me when the response.Body can be closed... /cc @baude |
I think Attach() blocks until it reads EOF. So defer should work no? |
@Luap99 I thought so, but the client fails to get any output when I defer the Close(). I have not had time to debug it yet. |
@jwhonce Once Attach has handed over to Libpod, all responsibility for closing the connection is handed over to that code (the termination conditions are very complex, and the only place that has enough information to be able to know when they are met is Libpod). As such, that Can you describe what's going on / why the body needs to be closed in more detail? |
@mheon If we don't close body at the end of the operation we "leak" the file descriptor. From godoc
|
@jwhonce I think the key is that we can only do that if the connection has not been hijacked ( |
b30c8da
to
9b95026
Compare
810f6eb
to
f16d52c
Compare
* Add response.Body.Close() where needed to release HTTP connections to API server. * Add tests to ensure no general leaks occur. 100% coverage would be required to ensure no leaks on any call. * Update code comments to be godoc correct Signed-off-by: Jhon Honce <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/lgtm |
connections to API server.
required to ensure no leaks on any call.
Signed-off-by: Jhon Honce [email protected]